L1-019 谁先倒

题目 L1-019 谁先倒

image-51b2e5d1

思路分析

image-4dfb5f0d

代码实现

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'

int main()
{
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int jla,jlb;cin>>jla>>jlb;
	int n;cin>>n;
	int drinka=0,drinkb=0;
	for(int i=0;i<n;i++){
		int t1,h1,t2,h2;cin>>t1>>h1>>t2>>h2;
		if(t1+t2==h1 && t1+t2!=h2)	drinka++;
		else if(t1+t2==h2 && t1+t2!=h1)	drinkb++;
		else continue;

		if(drinka > jla){
			cout<<"A"<<endl<<drinkb<<endl;
			break;
		}else if(drinkb > jlb){
			cout<<"B"<<endl<<drinka<<endl;
			break;
		}
	}

	return 0;
 }

同类题型

视频讲解


⬅️ L1-018 大笨钟 🏠 00-天梯赛 ➡️ L1-020 帅到没朋友